﻿<Window x:Class="CaliburnWpf.Views.Dictionaries.CategoryListView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="CategoriesWindow" Height="300" Width="300"
        
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"
    >
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Margin" Value="10,4"/>
            
        </Style>


        <DataTemplate x:Key="SubCategoryTemplate" >
            <ContentControl DataContext="{Binding .,Converter={StaticResource wrapper}}">
                <TextBlock Text="{Binding Name}"/>
            </ContentControl>
        </DataTemplate>


        <HierarchicalDataTemplate x:Key="CategoryTemplate"  ItemsSource="{Binding SubCategoryList,Converter={StaticResource wrapper}}"  ItemTemplate="{StaticResource SubCategoryTemplate}">
            <ContentControl DataContext="{Binding .,Converter={StaticResource wrapper}}">
                <TextBlock Text="{Binding Name}"/>
            </ContentControl>
        </HierarchicalDataTemplate>
    </Window.Resources>
    <Grid>
       
            <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <TreeView x:Name="tree"  SelectedItemChanged="tree_SelectedItemChanged">
                
            <TreeViewItem x:Name="Items" Header="Categories"  ItemTemplate="{StaticResource CategoryTemplate}" IsExpanded="True">
                
            </TreeViewItem>

        </TreeView>
        <TextBox Grid.Row="1" Margin="4" Text="{Binding CategoryName}"></TextBox>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Button x:Name="New" Content="Add" />
                
               
            <Button x:Name="Edit" Grid.Column="1" Content="Edit" />
            <Button x:Name="Delete" Grid.Column="2" Content="Delete" />
        </Grid>
        <Button x:Name="Select" Grid.Row="3" Content="Select" />
    </Grid>
</Window>
